const express = require('express');
const { routeWrapper } = require('../../../lib/module/tool/route');
const router = express.Router();

const areaService = require('../../../lib/service/areaService');

// 添加banner图
router.post('/:areaId/addbanner', routeWrapper(async (req) => {
    return areaService.addBanner(req.params.areaId, req.body.image, req.body.path);
}, true));

// 更新banner
router.post('/:areaId/updatebanner', routeWrapper(async (req) => {
    return areaService.updateBanner(req.params.areaId, req.body.image, req.body.path, req.body.id);
}, true));

// 删除banner图
router.post('/:areaId/:bannerId/deletebanner', routeWrapper(async (req) => {
    return areaService.deleteBanner(req.params.areaId, req.params.bannerId);
}, true));

// 添加activitybanner图
router.post('/:areaId/addactivitybanner', routeWrapper(async (req) => {
    return areaService.addActivityBanner(req.params.areaId, req.body.image, req.body.path);
}, true));

// 更新activitybanner
router.post('/:areaId/updateactivitybanner', routeWrapper(async (req) => {
    return areaService.updateActivityBanner(req.params.areaId, req.body.image, req.body.path, req.body.id);
}, true));

// 删除activitybanner图
router.post('/:areaId/:bannerId/deleteactivitybanner', routeWrapper(async (req) => {
    return areaService.deleteActivityBanner(req.params.areaId, req.params.bannerId);
}, true));

// 成交订单
router.post('/:areaId/order-statistics/overview/:offset/:rows', routeWrapper(async (req) => {
    return areaService.orderOverview(req.params.areaId, req.params.offset, req.params.rows, req.body);
}, true));

// 导出数据查询
router.post('/:areaId/order-statistics/exportorder', routeWrapper(async (req) => {
    return areaService.exportOrder(req.params.areaId, req.body);
}, true));

module.exports = router;
